package com.chixing.controller;

import com.chixing.service.NotesCollectionService;
import com.chixing.service.SightsCollectionService;


import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
public class NotesCollectionController {
    @Autowired
    private NotesCollectionService notesCollectionService;
    @GetMapping("/notes/{custId}")

    public ModelAndView getNotesbycustId(@PathVariable("custId") Integer custId ){
        ServerResponse response2=notesCollectionService.getNotesbycustId(custId);
        ModelAndView mav2 = new ModelAndView();
        mav2.addObject("response2",response2);
        mav2.setViewName("customer/customer_collection");
        return mav2;
    }
    @PostMapping("myorder")
    public ModelAndView delete( Integer notesCollectId , Integer custId ){
        ServerResponse ord_del =  notesCollectionService.deleteNotesbysightsId(notesCollectId);
        ModelAndView modelAndView = this.getNotesbycustId(custId);
        return modelAndView;
    }

}
